import router from "./router"
module.exports = {
  router,
  modules:[
    '@nuxtjs/axios',
    '@nuxtjs/proxy'
  ],
  env:{
    BASE_URL:process.env.BASE_URL,
    IMG_URL:process.env.IMG_URL
  },
  axios:{
    proxy:true,
    baseUrl:process.env.BASE_URL,
    headers: { 'Content-Type': 'application/json', 'crossDomain': true},
  },
  proxy:{
      "/api/":{
        target:process.env.BASE_URL,
        changeOrigin:true,
        pathRewrite: {
          '^/api': '' //将 /api 替换掉
          },
        },
    "/upload/":{
      target:process.env.IMG_URL,
      changeOrigin:true,
      pathRewrite: {
        '^/upload': '' //将 /api 替换掉
      },
    }
      },
  /*
  ** Headers of the page
  */
  head: {
    title: 'nuxt-browser',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: 'Nuxt.js project' }
    ],
    link: [
      {rel:'stylesheet',
        href:'/css/base.css'
      },
      {rel:'stylesheet',
        href:'/css/index.css'
      },
      {rel:'stylesheet',
        href:'/css/m.css'
      },
      {rel:'stylesheet',
        href:'/font-awesome-4.7.0/css/font-awesome.min.css',
        ssr: false

      },{rel:'stylesheet',
        href:'https://cdn.jsdelivr.net/npm/vditor/dist/index.css',
        ssr: false
      },


    ],
    script:[
      {src:'/js/jquery.min.js' },
      {src:'/js/hc-sticky.js' },
      {src:'/js/comm.js' }

    ]
  },
  /*
  ** Customize the progress bar color
  */
  loading: { color: '#3B8070' },
  /*
  ** Build configuration
  */
  css:[
    { src: "mavon-editor/dist/css/index.css" },
  ],
  plugins: [
    {src:"@/plugins/element-ui", ssr:true},
    {src: "~/plugins/axios"},
    {src: "~/plugins/mavon-editor",ssr: true},
    {src: "~/plugins/emoji", ssr: false},
    {src: "~/plugins/infinite-loading",ssr: false},
    {src: "~/plugins/globalmethod"},
    {src: "~/plugins/topic-plug"}
    ],

  build: {
    /*
    ** Run ESLint on save
    */
    extend (config, { isDev, isClient }) {
      if (isDev && isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    }
  }
}

